<template>
    <div >
        <div class="zuidaBox" v-if="itemList.length != 0">
            <div v-for="(item,index) in itemList" :key="index" class="box">
                <div class="flex align_center" style="margin-bottom: 1.5%;padding-left: 24px;">
                    <div class="flex align_center justify_center" style="margin-right: 10px;" :class="item.is_confirm == 0?'chek':'act_chek'" @click="item.is_confirm == 0?item.is_confirm = 1:item.is_confirm = 0">
                        <icon-check style="color:#fff" v-if="item.is_confirm == 1" />
                    </div>
                    <div style="font-weight: 600;margin-right: 40px;">账单号：{{ item.order_number }}</div>
                    <div style="margin-right: 40px;">创建时间：{{ item.created_at }}</div>
                    <div class="flex align_center" style="margin-right: 40px;">
                        <div >付款人：</div>
                        <a-select  v-model="item.pay_dept_id" style="width:390px;"
                        :options="dept_list" :filter-option="filterOption" :field-names="{ value: 'id', label: 'name' }" allow-clear allow-search
                        placeholder="请选择公司"  />
                    </div>
                </div>
                <!-- <div class="flex align_center" style="margin-bottom: 10px;padding-left: 24px;">
                    <div class="flex align_center" style="margin-right: 40px;">
                        <div >付款人：</div>
                        <a-select  v-model="item.dept_id" style="width:390px;"
                        :options="dept_list" :field-names="{ value: 'id', label: 'name' }" allow-clear allow-search
                        placeholder="请选择公司"  />
                    </div>
                    <div class="flex align_center">
                        <div >结算方式：</div>
                        <a-radio-group v-model="item.jiesuan" :options="jiesuanOptions" />
                    </div>
                </div> -->
                <a-table :columns="tablecolumnsts" :data="item.detail" :pagination='false' :span-method="spanMethodAll" :bordered="{wrapper: true, cell: true}">
                    <template #price_type="{record,rowIndex}">
                        <div class="flex align_center cursor" v-if="record.type == 0" @click="handlechek(index,rowIndex)">
                            <div class="flex align_center justify_center" style="margin-right: 10px;" :class="record.is_confirm == 0?'chek':'act_chek'" >
                                <icon-check style="color:#fff" v-if="record.is_confirm == 1" />
                            </div>
                            <div>{{ handletuhuanPriceType(record.price_type) }}</div>
                        </div>
                        <div v-if="record.type == 1">
                            <a-select  v-model="record.price_type" style="width:120px;"
                            :options="price_typeList" :field-names="{ value: 'key', label: 'title' }" allow-clear allow-search
                            placeholder="计费类型" @change="handleSelect($event,index,rowIndex)" />
                        </div>
                        <div v-if="record.type == 2">
                            <a-link @click="handleAdd(index,rowIndex,1)"><icon-plus /> 添加费用项</a-link>
                        </div>
                    </template>
                    <template #no_tax_price="{record}">
                        <div v-if="record.price_type && record.pay_real_price">{{ (record.no_tax_price - 0).toFixed(2)  }}</div>
                        <div v-else></div>
                    </template>
                    <template #tax_price="{record}">
                        <div v-if="record.price_type && record.pay_real_price">{{ (record.tax_price - 0).toFixed(2)  }}</div>
                        <div v-else></div>
                    </template>
                    <template #pay_name="{record}">
                        <div v-if="record.type == 0">{{ record.pay_name }}</div>
                        <div v-if="record.type == 1">
                            <a-input v-model="record.pay_name"  placeholder="项目名称" allow-clear />
                        </div>
                    </template>
                    <template #pay_price="{record}">
                        <div v-if="record.type == 0">{{ record.pay_price }}</div>
                        <div v-if="record.type == 1">
                            <a-input v-model="record.pay_price"  placeholder="原金额" allow-clear />
                        </div>
                    </template>
                    <template #pay_real_price="{record,rowIndex}">
                        <div v-if="record.type == 0">
                            <a-input v-model="record.pay_real_price"  placeholder="实际金额" allow-clear @input="handleInput($event,index,rowIndex)" />
                        </div>
                        <div v-if="record.type == 1">
                            <a-input v-model="record.pay_real_price"  placeholder="实际金额" allow-clear @input="handleInput($event,index,rowIndex)" />
                        </div>
                    </template>
                    <template #remark="{record}">
                        <div v-if="record.type == 0">{{ record.remark }}</div>
                        <div v-if="record.type == 1">
                            <a-input v-model="record.remark"  placeholder="备注" allow-clear />
                        </div>
                    </template>
                    <template #caozuo="{record,rowIndex}">
                        <div v-if="record.type == 0">-</div>
                        <div v-if="record.type == 1">
                            <a-link @click="handleAdd(index,rowIndex,2)">删除</a-link>
                        </div>
                    </template>
                    
                </a-table>
            </div>
        </div>
        <div class=" flex align_center" style="padding: 10px 0 0;border-top: 1px solid rgba(0, 0, 0, .15);" v-if="itemList.length != 0">
            <div class="flex flex_1 justify_around">
                <div>不含税合计金额：{{handleZongPrice(3)}}</div>
                <div>税额合计金额：{{handleZongPrice(4)}}</div>
                <div>原合计金额：{{handleZongPrice(1)}}</div>
                <div>实际支付合计金额：{{handleZongPrice(2)}}</div>
            </div>
            <div class="flex" >
                <!-- <a-button style="margin-right: 20px;" @click="handleCel">取消支付</a-button> -->
                <!-- zhifuShow = true -->
                <a-popconfirm @ok="handleZhifu" content="是否生成账单？">
                    <a-button type="primary" >确定选择</a-button>
                </a-popconfirm>
                
            </div>
        </div>
        <div v-if="itemList.length == 0">
            <a-empty />
        </div>
        <a-modal :mask-closable="false"  v-model:visible="zhifuShow" title="支付" @cancel="zhifuShow = false" :width="600" :on-before-ok="handelzhifuOk">
                <div class="" style="margin-bottom: 2%;padding-left: 24px;height: 300px;">
                    <div class="flex align_center" style="margin-bottom: 2%;">
                        <div style="width: 80px;">结算方式：</div>
                        <a-radio-group v-model="jiesuan" :options="jiesuanOptions" />
                    </div>
                    <div v-if='jiesuan == "3"'>
                        <div style="display: flex;align-items: center;margin-bottom: 2%;">
                            <div style="width: 80px;">支付方式</div>
                            <a-radio-group v-model="zhifu" :options="zhifuOptions" />
                        </div>
                        <!-- <div style="display: flex;align-items: center;margin-bottom: 2%;">
                            <div style="width: 80px;">开户行</div>
                            <div >{{opening_bank}}</div>
                        </div>
                        <div style="display: flex;align-items: center;margin-bottom: 2%;">
                            <div style="width: 80px;">收款账户</div>
                            <div >{{account}}</div>
                        </div>
                        <div style="display: flex;align-items: center;margin-bottom: 2%;">
                            <div style="width: 80px;">开户名称</div>
                            <div >{{account_name}}</div>
                        </div>
                        <div style="display: flex;margin-bottom: 2%;">
                            <div style="width: 80px;">上传凭证</div>
                            <ma-upload v-model="fileList" returnType='url' />
                        </div> -->
                    </div>
                    <div style="display: flex;align-items: center;margin-bottom: 2%;">
                        <div style="width: 80px;">支付时间</div>
                        <a-date-picker
                            style="width: 100%; "
                            show-time
                            v-model="pay_date"
                            format="YYYY-MM-DD HH:mm"
                        />
                    </div>
                </div>
        </a-modal>
    </div>
</template>

<script setup>
    import { defineProps, defineEmits, ref, reactive, onMounted } from "vue";
    import FinancialPayOrder from "@/api/financial/financialPayOrder";
    import { request } from "@/utils/request.js";
    import { pinyin } from "pinyin-pro"
    import commonApi from "@/api/common";
    import tool from '@/utils/tool'
    import { Message } from "@arco-design/web-vue";
    const emit = defineEmits(['quxiao','shuaxin'])
    const props = defineProps({
        item: Object,
        type: Number,   //   type = 1 提货  type = 2 到货  type = 3 装车单
    })
    const zongPrice = ref(0)
    const itemData = ref({
        page:1,
        pageSize:100,
        is_confirm:0,
    })
    const pay_date = ref(tool.dateFormat(
			Math.round(new Date().getTime() / 1000).toString(),
			"yyyy-MM-dd hh:mm:ss"
		))
    const zhifu = ref('3')
    const jiesuan = ref('')
    const opening_bank = ref()
    const account = ref()
    const account_name = ref()
    const fileList = ref('')
    const zhifuOptions = ref([
        { label: '对公转账', value: '3' },
        { label: '现金', value: '2' },
        { label: '惠支付', value: '1' },
    ])
    const dept_list = ref([])
    const itemList = ref([])
    const price_typeList = ref([])    // 计费类型
    const zhifuShow = ref(false)
    const jiesuanOptions = ref([
          {
            label: "现结",
            value: "3",
            disabled:true,
          },
          {
            label: "周期结算",
            value: "2",
            disabled:true,
          },
          {
            label: "预付款",
            value: "1",
            disabled:true,
          }
    ]) 

    const tablecolumnsts = [
        {
          title: '车号',
          dataIndex: 'car_nos',
          width:120,
          
        },
        {
          title: '计费类型',
          dataIndex: 'price_type',
          width:140,
          slotName:'price_type'
        },
        {
          title: '收费项目',
          dataIndex: 'pay_name',
          width:140,
          slotName:'pay_name'
        },
        {
            title: '不含税金额',
            dataIndex: 'no_tax_price',
            width:110,
            slotName:'no_tax_price'
        },
        {
            title: '税额',
            dataIndex: 'tax_price',
            width:80,
            slotName:'tax_price'
        },
        {
          title: '原金额',
          dataIndex: 'pay_price',
          width:120,
          slotName:'pay_price'
        },
        {
          title: '实际金额',
          dataIndex: 'pay_real_price',
          width:120,
          slotName:'pay_real_price'
        },
        
        {
          title: '天-D',
          dataIndex: 'day',
          width:80,
        },
        {
          title: '吨-T',
          dataIndex: 'weight',
          width:80,
        },
        {
          title: '车-C',
          dataIndex: 'car_no_value',
          width:80,
        },
        {
          title: '箱-X',
          dataIndex: 'box',
          width:80,
        },
        {
          title: '计费规则',          
          dataIndex: 'chi_price_role',
          width:140,
        },
        {
          title: '备注',
          dataIndex: 'remark',
          width:140,
          slotName:'remark'
        },
        {
          title: '操作',
          dataIndex: 'caozuo',
          slotName:'caozuo',
          width:80,
        },
    ];
    const filterOption = (v,option)=>{
  return option.keywords.some(keywords=>keywords.includes(v))
}
    const handleSelect = (e,index,indexs)=>{
        if(itemList.value[index].detail[indexs].pay_real_price != ''){
            gethandleShuilv(index,indexs) 
        }
    }
    const handleInput = (e,index,indexs)=>{
        if(itemList.value[index].detail[indexs].price_type != ''){
            gethandleShuilv(index,indexs) 
        }
    }
    const gethandleShuilv = (index,indexs)=>{
        request({
            url: "financial/payOrder/get_tax_price",
            method: "post",
            data: {
                price_type:itemList.value[index].detail[indexs].price_type,
                price:itemList.value[index].detail[indexs].pay_real_price,
            },
        }).then((res) => {
            console.log(res)
            itemList.value[index].detail[indexs].no_tax_price = res.data.no_tax_price
            itemList.value[index].detail[indexs].tax_price = res.data.tax_price
        });
    }
    onMounted(()=>{
        console.log('props:',props.item)
        if(props.type == 1){
            itemData.value.prediction_order_id = props.item.id
        }else if(props.type == 2){
            itemData.value.send_id = props.item.id
        }else if(props.type == 4){
            itemData.value.driver_order_id = props.item.id
        }
        commonApi.getDict("price_type").then((res) => {
            price_typeList.value = res.data;
        });
        getdaozhanList()
        handleDeptList()
    })
    const getaccount = () =>{
        request({
            url: "system/dataDict/index",
            method: "get",
            params: {
            page:1,
                pageSize:10,
                type_id:41
            },
        }).then((res) => {
            opening_bank.value = res.data.items[0].value
            account.value = res.data.items[1].value
            account_name.value = res.data.items[2].value
        });
    }
    const handleConsole = ()=>{
        console.log(itemList.value)
    }
    const handleCel = () =>{  // 取消支付
        emit('quxiao')
    }
    const handleZhifu = ()=>{
        let arr = []
        let err = 0    //  错误提示   1 没有选择付款人  2 实际金额为空或为负数  3 计费类型  4 收费项目  5 原金额  6 请选择账单
        // console.log('itemList',itemList.value)
        itemList.value.map((v,i)=>{
            if(v.is_confirm == 1){
                arr.push(JSON.parse(JSON.stringify(v)))
                if(v.pay_dept_id == ''){
                    err = 1
                }
                v.detail.map((vv,ii)=>{
                    if((vv.type == 0) && vv.is_confirm == 1){
                        if(vv.pay_real_price == '' || (vv.pay_real_price - 0) < 0){
                            err = 2
                        }
                    }
                    if(vv.type == 1){
                        if(vv.price_type != '' || vv.pay_name != '' || vv.pay_price != '' || vv.pay_real_price != ''){
                            if(vv.price_type == ''){
                                err = 3
                            }
                            if(vv.pay_name == ''){
                                err = 4
                            }
                            if(vv.pay_price == '' || (vv.pay_price - 0) < 0){
                                err = 5
                            }
                            if(vv.pay_real_price == '' || (vv.pay_real_price - 0) < 0){
                                err = 2
                            }
                        }
                        
                    }
                })
            }
        })
        // console.log('arr',arr)
        if(arr.length == 0){
            err = 6
        }
        
        if(err == 1){
            return Message.error('请选择付款人')
        }else if(err == 2){
            return Message.error('实际金额不能为空或为负数')
        }else if(err == 3){
            return Message.error('请选择计费类型')
        }else if(err == 4){
            return Message.error('请输入收费项目')
        }else if(err == 5){
            return Message.error('原金额不能为空或为负数')
        }else if(err == 6){
            return Message.error('请选择账单')
        }else{
            arr.map((v,i)=>{
                let detailArr = []
                v.detail.map((vv,ii)=>{
                    // console.log('vv',vv)
                    if((vv.type == 0) && vv.is_confirm == 1){
                        detailArr.push(vv)
                    }
                    if(vv.type == 1){
                        if(vv.price_type != '' && vv.pay_name != '' && vv.pay_price != '' && vv.pay_real_price != ''){
                            detailArr.push(vv)
                        }
                        
                    }
                })
                v.detail = detailArr
            })
            console.log('arr',arr)
            let pay_method = arr[0].send.contract.pay_method.split(',')
            request({
                url: 'financial/payOrder/confirm',
                method: 'post',
                data: {
                    items:arr
                }
            }).then(res => {
                zhifuShow.value = true
                getaccount()
                jiesuanOptions.value.map((v,i)=>{
                    pay_method.map((vv,ii)=>{
                        if(vv == v.value){
                            jiesuan.value = v.value
                            v.disabled = false 
                        }
                    })
                    
                })
            })
        }
        
        
    }
    const handelzhifuOk = async ()=>{ // 支付成功
        let obj = {}
        let ids = []
        itemList.value.map((v,i)=>{
            if(v.is_confirm == 1){
                ids.push(v.id)
            }
        })
        if(jiesuan.value == '1' || jiesuan.value == '2'){
            // obj.pay_type = jiesuan.value
            obj.pay_type = jiesuan.value == 1?'money':'periodic'
            obj.ids = ids.join(',')
            obj.pay_date = pay_date.value
        }
        if(jiesuan.value == '3'){
            obj.pay_type = 'now_pay'
            obj.ids = ids.join(',')
            obj.now_pay_type = zhifu.value
            obj.transfer_proof_images = fileList.value
            obj.payment_method = zhifu.value
            obj.settlement_method = 1
            obj.notes = ''
            obj.pay_date = pay_date.value
            // obj.pay_order_id = this.zhifu_id    // 交易单号
            obj.dept_id = itemList.value[0].dept_id    // 公司
            obj.opening_bank = opening_bank.value    // 开户行
            obj.account = account.value    // 收款账户
            obj.account_name = account_name.value    // 开户行名称
        }
        let res = await request({
            url: "financial/payOrder/pay",
            method: "post",
            data: obj,
        })
        if(res.code == 200){
            emit("shuaxin")
            Message.success(res.message);
            return true
        }else{
            Message.error(res.message);
            return false
        }
        
    }
    const handlechek = (index,rowIndex) =>{
        itemList.value[index].detail[rowIndex].is_confirm == 0?itemList.value[index].detail[rowIndex].is_confirm = 1:itemList.value[index].detail[rowIndex].is_confirm = 0
    }
    const  spanMethodAll= ({record,rowIndex, columnIndex}) => {
      if (rowIndex === record.weizhi - record.weizhizong && columnIndex === 0) {
        return {rowspan: record.weizhizong,colspan:1}
      }
    };
    const handleDeptList = () => {   //  获取公司列表
        request({
            url: 'system/dept/remote',
            method: 'post',
            data: {
            openPage: false,
            remoteOption: {
                filter: {
                type: ['=', 2],
                status: ['=',1]
                },
                select: ["id", "name"],
                sort: { id: "desc" }
            }
            }
        }).then(res => {
            res.data.map((v,i)=>{
                    v.keywords = [
                    v.name,
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
                    ]
            })
            dept_list.value = res.data
        })
    }
    const getdaozhanList = ()=>{
        FinancialPayOrder.getdaozhanList(itemData.value).then(res=>{
            let params = res.data.items
            let number = 0
            params.map((v,i)=>{
                v.payment_id = ''
                v.jiesuan = ''
                v.pay_dept_id = ''
                v.is_confirm = 1
                v.pay_dept_id = v.dept_id || ''
                let arr = []
                let arrs = []
                if(v.pay_status == 1){
                    number += (v.pay_price - 0)
                }
                v.detail.map((vv,ii)=>{
                    vv.type = 0
                    vv.caozuo = ''
                    vv.pay_dept_id = vv.dept_id
                    // if(v.send_id){
                    vv.car_nos = v.send.car_no || ''
                    vv.no_tax_price = (vv.no_tax_price - 0 ).toFixed(2)
                    vv.tax_price = (vv.tax_price - 0 ).toFixed(2)
                    vv.pay_real_price = (vv.pay_real_price - 0 ).toFixed(2)
                    vv.pay_price = (vv.pay_price - 0 ).toFixed(2)
                   
                    if(vv.pay_price != '0.00'){
                        arr.push(vv)
                    }
                })
                v.detail = handleSOrt(arr)
                v.detail = handleWeizhi(v.detail)
                if(v.pay_status != 2){
                    v.disabled = true
                }
                if(v.pay_status == 2 && v.is_wait_check == 1){
                    v.disabled = true
                }
                v.order_no = v.driver_order?.order_no || ''
            })
            itemList.value = params
        })
    }

    const handleSOrt = (ceshiArr)=>{
        let arr = []           // 最终数据
        let linshiArr = []     //  未匹配的放数组里
        let linshititle = ''   // 临时变量
        ceshiArr.map((v,i)=>{
        if(i == 0){
            linshititle = v.name
            arr.push(v)
        }else{
            if(linshititle == v.name){
            arr.push(v)
            }else{
            linshiArr.push(v)
            }
        }
        })
        ceshiArr.map((v,i)=>{
        if(linshiArr.length != 0){
            linshiArr.map((vv,ii)=>{
            if(ii == 0){
                linshititle = linshiArr[0].name
                arr.push(linshiArr.shift())
            }else{
                if(linshititle == vv.name){
                arr.push(linshiArr.slice(ii,1))
                }
            }
            
            })
            
        }
        })
        arr.sort((a, b) => a.car_nos.localeCompare(b.car_nos));
        return arr
    }
    const handleWeizhi = (detail)=>{
        console.log('detail:',detail)
        let carArr = []
        let carArrs = []
        detail.map((vv,ii)=>{
            carArr.push(vv.car_nos)
            carArrs.push({car_no:vv.car_nos,send_id:vv.send_id,billing_node:vv.billing_node})
        })
        var newArr = carArr.filter(function(item,index){  // 获取有多少车号
            return carArr.indexOf(item) === index;  // 因为indexOf 只能查找到第一个  
        });
        let numArr = []
        newArr.map((vv,ii)=>{
            let num = 0
            let name = ''
            let send_id = ''
            let billing_node = ''
            carArrs.map((vvv,iii)=>{
                if(vv == vvv.car_no){
                    num++
                    name = vvv.car_no
                    billing_node = vvv.billing_node
                    send_id = vvv.send_id
                }
            })
            numArr.push({car_no:name,weizhi:num,weizhizong:num,send_id,billing_node})
        })
        console.log('numArr',numArr)
        let weizhiArr = []
        let weizhinum = 0
        numArr.map((vv,ii)=>{
            weizhinum += vv.weizhi
            weizhiArr.push({car_no:vv.car_no,weizhi:weizhinum,weizhizong:vv.weizhizong,billing_node:vv.billing_node,send_id:vv.send_id})
        })
        let tianjia = []
        console.log('weizhiArr',weizhiArr)
        weizhiArr.map((vv,ii)=>{
            tianjia = [{send_id:vv.send_id,billing_node:vv.billing_node,car_nos:vv.car_no,price_type:'',pay_name:'',pay_price:'',pay_real_price:'',day:'',weight:'',car_no_value:'',box:'',price_role:'',remark:'',type:1,caozuo:'',no_tax_price:'',tax_price:'',is_confirm:1},{car_nos:vv.car_no,price_type:'',pay_name:'',pay_price:'',day:'',weight:'',car_no_value:'',box:'',price_role:'',remark:'',type:2,caozuo:'',no_tax_price:'',tax_price:''}]
            detail.splice((vv.weizhi + (2 * ii)),0,...tianjia)
        })
        carArr = []
        detail.map((vv,ii)=>{
            carArr.push(vv.car_nos)
        })
        var newArr = carArr.filter(function(item,index){  // 获取有多少车号
            return carArr.indexOf(item) === index;  // 因为indexOf 只能查找到第一个  
        });
        numArr = []
        newArr.map((vv,ii)=>{
            let num = 0
            let name = ''
            carArr.map((vvv,iii)=>{
            if(vv == vvv){
                num++
                name = vvv
            }
            })
            numArr.push({car_no:name,weizhi:num,weizhizong:num})
        })
        weizhiArr = []
        weizhinum = 0
        numArr.map((vv,ii)=>{
            weizhinum += vv.weizhi
            weizhiArr.push({car_no:vv.car_no,weizhi:weizhinum,weizhizong:vv.weizhizong})
        })
        detail.map((vv,ii)=>{
            weizhiArr.map((vvv,iii)=>{
            if(vv.car_nos == vvv.car_no){
                vv.weizhi = vvv.weizhi
                vv.weizhizong = vvv.weizhizong
            }
            })
        })
        return detail
    }
    const handleAdd = (index,rowIndex,type)=>{
        itemList.value.map((v,i)=>{
            if(i == index){
                let carArr = []
                if(type == 1){  // 新增
                    let car_nos = v.detail[rowIndex - 1].car_nos
                    let send_id = v.detail[rowIndex - 1].send_id
                    let billing_node = v.detail[rowIndex - 1].billing_node
                    v.detail.splice(rowIndex,0,{send_id,billing_node,car_nos:car_nos,price_type:'',pay_name:'',pay_price:'',pay_real_price:'',day:'',weight:'',car_no_value:'',box:'',price_role:'',remark:'',type:1,caozuo:'',is_confirm:1})
                }else{  // 删除
                    v.detail.splice(rowIndex,1)
                }
                console.log('detail:',v.detail)
                v.detail.map((vv,ii)=>{
                    carArr.push(vv.car_nos)
                })
                var newArr = carArr.filter(function(item,index){  // 获取有多少车号
                    return carArr.indexOf(item) === index;  // 因为indexOf 只能查找到第一个  
                });
                let numArr = []
                newArr.map((vv,ii)=>{
                    let num = 0
                    let name = ''
                    carArr.map((vvv,iii)=>{
                    if(vv == vvv){
                        num++
                        name = vvv
                    }
                    })
                    numArr.push({car_no:name,weizhi:num,weizhizong:num})
                })
                let weizhiArr = []
                let weizhinum = 0
                numArr.map((vv,ii)=>{
                    weizhinum += vv.weizhi
                    weizhiArr.push({car_no:vv.car_no,weizhi:weizhinum,weizhizong:vv.weizhizong})
                })
                v.detail.map((vv,ii)=>{
                    weizhiArr.map((vvv,iii)=>{
                    if(vv.car_nos == vvv.car_no){
                        vv.weizhi = vvv.weizhi
                        vv.weizhizong = vvv.weizhizong
                    }
                    })
                })
            }
        })
    }
    const handletuhuanPriceType = (id)=>{
        let name = ''
        price_typeList.value.map((v,i)=>{
            if(v.key == id){
                name = v.title 
            }
        })
        return name
    }
    const handleZongPrice = (status) =>{
        let num = 0
        itemList.value.map((v,i)=>{
            v.detail.map((vv,ii)=>{
                
                if(vv.is_confirm == 1 && status == 1){
                    if(vv.pay_price == ''){
                        num += 0
                    }else{
                        num += (vv.pay_price - 0)
                    }
                    
                }
                if(vv.is_confirm == 1 && status == 2){
                    if(vv.pay_real_price == ''){
                        num += 0
                    }else{
                        num += (vv.pay_real_price - 0)
                    }
                }
                if(vv.is_confirm == 1 && status == 3){
                    console.log(status,vv.no_tax_price)
                    if(vv.no_tax_price == ''){
                        num += 0
                    }else{
                        num += (vv.no_tax_price - 0)
                    }
                }
                if(vv.is_confirm == 1 && status == 4){
                    if(vv.tax_price == ''){
                        num += 0
                    }else{
                        num += (vv.tax_price - 0)
                    }
                }
            })
        })
        console.log(status,num)
        return num.toFixed(2)
    }
</script>

<style lang="less" scoped>
.zuidaBox{
    max-height: 700px;
    overflow: auto;
    scrollbar-width: none;
}
.zuidaBox::-webkit-scrollbar {
  display: none; /* 对于 Chrome, Safari 和 Opera */
}
.box{
    
    margin-bottom: 20px;
    &:last-child{
        margin-bottom:0;
    }
}
.chek{
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, .15);
}
.act_chek{
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgb(22, 93, 255);
    background: rgb(22, 93, 255);
}
</style>